Add support for unordered XML comparison in compliance checks#1022
Add support for unordered XML comparison in compliance checks#1022
Conversation
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
| compliance = not missing and not extra | ||
| compliance_int = int(compliance) | ||
| ordered = obj.ordered | ||
| ordered = obj.rule.config_ordered |
There was a problem hiding this comment.
I don't think this is accurate. I think that ordered here showed if it was in fact ordered. Meaning "I may or may not care it's ordered, but this config is fact ordered"
I could be wrong on that, but at least that is how it works on the cli side. It allowed me to short circuit certain conditions.
There was a problem hiding this comment.
i see, i think we could replicate this but would need to diff twice if they didn't have order checked in the rule
ordered_missing = main.diff_texts(obj.actual, obj.intended, diff_options=diff_options)
ordered_extra = main.diff_texts(obj.intended, obj.actual, diff_options=diff_options)
ordered_compliant = not ordered_missing and not ordered_extra
if obj.rule.config_ordered:
missing = ordered_missing
extra = ordered_extra
else:
actual_xml = _sort_xml(obj.actual)
intended_xml = _sort_xml(obj.intended)
missing = main.diff_texts(actual_xml, intended_xml, diff_options=diff_options)
extra = main.diff_texts(intended_xml, actual_xml, diff_options=diff_options)
compliance = not missing and not extra
compliance_int = int(compliance)
ordered = ordered_compliant
|
overall, i think this is good, @jeffkala thoughts? |
jeffkala
left a comment
There was a problem hiding this comment.
seems good to me. Have you fully tested it in a lab type env?
I haven't, the tests run the actual compliance jobs tho - is there something i'm missing that the tests don't cover? |
Nearly every time this has not been tested it has introduced some kind of bug so we are a bit skittish. |
|
hmm ok, i just checked my dev environment and i don't have anything setup - if one of you guys can easily test this i'd appreciate it, otherwise i'll get to it when i get to it |
|
PR #1013 may help with spinning up a test environment quickly for this and other new features |
Closes: #1020
What's Changed
Adds unordered support for XML
To Do